<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    function fn(triplets, target) {
      let [a, b, c] = target, k1, k2, k3 = 0
      for (const [x, y, z] of triplets) {
        if (x > a || y > b || z > c) continue
        if (x === a) k1 = 1
        if (y === b) k2 = 1
        if (x === c) k3 = 1
      }
      return k1 === 1 && k2 === 1 && k3 === 1
    }
    console.log(fn([[2, 5, 3], [2, 3, 4], [1, 2, 5], [5, 2, 3]], [5, 5, 5]))
  </script>
</body>
</html>